package widget;

import java.util.HashMap;

/**
 * Created by LLAP on 2017/12/25.
 * Copyright (c) 2017 LLAP. All rights reserved.
 */
public class TDirectionSelector extends TComponent {

    public TDirectionSelector(String name, String comment, boolean required) {
        super(name, new DirectionSelector(), comment, required);
    }

    public TDirectionSelector(String name, String comment) {
        this(name, comment, false);
    }

    public TDirectionSelector(String name, boolean required) {
        this(name, "", required);
    }

    @Override
    public void clear() {
        ((DirectionSelector)field).clearSelection();
    }

    @Override
    public HashMap<String, Object> getData() throws IllegalArgumentException {
        return new HashMap<String, Object>() {{
            put(name, ((DirectionSelector)field).getSelectedDirection());
        }};
    }
}
